<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="app"></div>
</body>
<script>
    Vue.createApp({
        data() {
            return {
                value:'',
                list:[]
            }
        },
        methods: {
            additem(){
                this.list.push(this.value)
                this.value = ''
            }
        },
        created() {
            
        },
        mounted() {
            
        },
        template: `
        <div>
            <input v-model="value"/><button @click="additem">增加</button>
            <ul>
                <li v-for="(item,index) in list"> {{index}}---{{item}}</li>
            </ul>
        </div>`
    }).mount("#app")
</script>

</html>